package com.ideasindustry.photoontaje.service.providers.systemfile;

import java.io.File;
import java.io.FileFilter;
import java.util.Iterator;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.FileFileFilter;

import com.ideasindustry.photoontaje.api.PictureLightVO;
import com.ideasindustry.photoontaje.service.providers.PictureProviderIterator;

public class SystemFilePictureProviderIterator   implements PictureProviderIterator {

	public static final String[] PICTURE_EXTENSIONS = {"jpg","png"}; 
	
	public SystemFilePictureProviderIterator(File path) {
		iter = FileUtils.iterateFiles(path, PICTURE_EXTENSIONS , true);
	}
	
	private Iterator<File> iter;
	
	public boolean hasNext() {
		return iter.hasNext();
	}

	public PictureLightVO next() {
		File file =  iter.next();
	 	PictureLightVO picture = new PictureLightVO();
	 	picture.setPath(file.getAbsolutePath());
		return picture;
	}

	public void remove() {
		iter.remove();
	}
	
	
}
